#ifndef SJRPASSWORD_APIS_IMPL_HPP
#define SJRPASSWORD_APIS_IMPL_HPP

static EpubPassword *sPwd = nullptr;

void Pwd_Init(char const *path) {
  sPwd = new EpubPassword(path);
}

void Pwd_Release() {
  if (sPwd == nullptr)
    return;

  delete (sPwd);
  sPwd = nullptr;
}

int Pwd_PasswordInit(int num, char const *pwd) {
  return (*sPwd).init(num, pwd, static_cast<int>(strlen(pwd)));
}

int Pwd_PasswordVerify(int num, char const *pwd) {
  return (*sPwd).verify(num, pwd, static_cast<int>(strlen(pwd)));
}

int Pwd_PasswordChange(int num, char const *src, char const *dst) {
  return (*sPwd).change(num, src, static_cast<int>(strlen(src)), dst,
    static_cast<int>(strlen(dst)));
}

#endif//SJRPASSWORD_APIS_IMPL_HPP
